import request from "@/utils/shoppingRequest";
export function getLogin() {
  return request({
    url: "/users/login",
    method: "POST",
    data: {
      username: "admin",
      password: "123456",
    },
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
    },
  });
}

export function getShopping() {
  return request({
    url: "/cart/list",
    method: "GET",
    data: {
      id: 1,
    },
  });
}

export function getCommodity(data) {
  return request({
    url: "/goods/list",
    method: "GET",
    data,
  });
}

export function getCategory() {
  return request({
    url: "/goods/category",
    method: "GET",
  });
}
// 添加购物车
export function getAddCart(data) {
  return request({
    url: "/cart/add",
    method: "POST",
    data,
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
    },
  });
}
//改变选中状态
export function getChangeChecked(data) {
  return request({
    url: "/cart/select",
    method: "POST",
    data,
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
    },
  });
}

//删除所有选中商品
export function getDeleteChecked() {
  return request({
    url: "/cart/remove/select",
    method: "get",
    data: { id: 1 },
  });
}
//改变购物车所有商品的选中状态
export function getChangeAllChecked(data) {
  return request({
    url: "/cart/select/all",
    method: "POST",
    data,
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
    },
  });
}
//点击修改商品数量
export function getChangeCount(data) {
  return request({
    url: "/cart/number",
    method: "POST",
    data,
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
    },
  });
}
//删除单个商品
export function getDeleteOne(data) {
  return request({
    url: "/cart/remove",
    method: "get",
    data,
  });
}

//支付
export function getPay(data) {
  return request({
    url: "cart/pay",
    method: "POST",
    data: { id: 1 },
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
    },
  });
}
